﻿@{
    ViewBag.Title = "新账号配置页面";
    Layout = "~/Views/Shared/IniterBaseView.cshtml";
}
<script type="text/javascript">
    function Delete(id) {
        if (confirm("确定要删除操作员吗？")) {
            var inProcess = false;
            var set = document.getElementById("idd").value;
            if (set == 1) {
                inProcess = true;
            }
            if (inProcess) {
                location.href = "/Operator/Delete/" + id + "?type=1";
            } else {
                location.href = "/Operator/Delete/" + id;
            }

        }
    }

    function Edit(id) {
        var inProcess = false;
        var set = document.getElementById("idd").value;
        if (set == 1) {
            inProcess = true;
        }
        if (inProcess) {
            location.href = "/Operator/Edit/" + id + "?type=1";
        } else {
            location.href = "/Operator/Edit/" + id;
        }

    }
</script>
<div style="height: 40px; width: 100%; line-height: 40px;">
    <p>
        &nbsp;
    </p>
</div>
<div style="font-size: 22pt; text-align: center;">
    操作员信息<span style="font-size: 9pt;"> 确认</span></div>
<form method="post" action="" id="form1">
<input type="hidden" name="iid" id="idd" value="@ViewBag.iid" />
<div style="height: 20px; width: 80%; line-height: 20px; text-align: right; float: none;">
</div>
<div style="width: 100%; text-align: center; padding-left: 10%;">
    <table style="width: 80%;" class="list">
        <tr>
            <td class="title">
                操作员姓名
            </td>
            <td class="title">
                所属小组
            </td>
            <td class="title">
                编辑
            </td>
            <td class="title">
                删除
            </td>
        </tr>
        @foreach (BenefitHelper.Sys.Operator t in ViewBag.operators)
        {
            <tr>
                <td style="width: 50%;">
                    @t.UName
                </td>
                <td>
                    @{
               string groupname = "";
               List<BenefitHelper.Sys.Groups> groups = ViewBag.groups;
               foreach (BenefitHelper.Sys.GroupOperators go in ViewBag.gos)
               {
                   if (go.OperatorId == @t.Id)
                   {
                       groupname = groups.Where(a => a.Id == go.GroupId).First().GroupName;
                       break;
                   }
               }
                    }
                    @groupname
                </td>
                <td style="width: 80px;">
                    <span onclick="Edit(@t.Id)" style="">编辑</span>
                </td>
                <td style="width: 80px;">
                    <span onclick="Delete(@t.Id)" style="">删除</span>
                </td>
            </tr> 
        }
    </table>
</div>
</form>
<div style="height: 20px; width: 80%; line-height: 20px; text-align: right; float: none;">
    <div style="padding-top: 30px;">
        <a href="/Operator/Create?type=@ViewBag.iid">添加 一个新的操作员</a>
    </div>
</div>
<div style="height: 20px; width: 100%; line-height: 20px;">
    <p>
        &nbsp;
    </p>
</div>
@if (string.IsNullOrEmpty(ViewBag.iid))
{
    <div style="font-size: 16pt; text-align: center;" class="list">
        <span style="font-size: 9pt;"><span onclick="javascript:location.href='/Init/AddNewGroups'">
            上一步</span> </span>点击 <span>@Html.ActionLink("下一步", "AddNewAccount", "Init", null, null)</span>
        继续</div>
}
else
{
    <div style="font-size: 16pt; text-align: center;" class="list">
        <span onclick="javascript:location.href='/Init/More'">返回</span></div>
}
<div style="height: 40px; width: 100%; line-height: 40px;">
    <p>
        &nbsp;
    </p>
</div>
